﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    查看条目
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<h2>
<%if (ViewData["Draft"] != null)
  {%>
查看草稿
<%}
  else if (ViewData["submit"] != null)
  {%>
查看提交
  <%}
  else
  {%>
查看条目<br />
查看条目时，本页面只会显示本条目已被审核通过的最新编辑版本。
<%} %>
</h2>
<% KnowledgeEntity.Article article = ViewData["article"] as KnowledgeEntity.Article;
   KnowledgeEntity.Article latestArticle = ViewData["latestArticle"] as KnowledgeEntity.Article;
   KnowledgeEntity.UserAccount user = KnowledgeEntity.UserAccountFactory.GetUserInstanceByCode(User.Identity.Name);
   %>
<dl>
   <dt><b>题目: </b></dt><dd><%= article.Title %></dd>
   <dt><b>分类：</b></dt><dd><%= string.IsNullOrEmpty(article.Category.Name) ? "未分类" : article.Category.Name %></dd>
   <dt><b>当前状态：</b><%=latestArticle.Status == KnowledgeEntity.Article_Status.CHECKED_IN ?
            "可编辑" : (latestArticle.Status == KnowledgeEntity.Article_Status.WAIT_FOR_APPROVING ?
            "等待评审":"编辑中") %></dt><dd></dd>
   <dt><b>最新版由:</b><%= article.User.Name %> <b>撰写</b></dt><dd></dd>
   <dt><b>内容: </b></dt><dd><%= article.Content.Replace("\r\n","<br />") %></dd>
</dl>
<%= Html.ActionLink("编辑条目",string.Format("EditArticle/{0}",article.ArticleID),"Article") %>
<% if (user is KnowledgeEntity.ProfessorAccount && latestArticle.Status == KnowledgeEntity.Article_Status.WAIT_FOR_APPROVING)
   { %>
   <%=Html.ActionLink("评审条目",string.Format("ApproveArticle/{0}",article.ArticleID),"Article") %>
<%} %>
</asp:Content>
